package ml.kupin.sso.utils;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

/**
 * 字符串加密工具类
 * Created by 小柯(Allen Kerr) on 17.5.5 11:11.
 */
public class EncryptUtils {

    /**
     * 加密字符串
     * md5 ——> reverse ——> md5
     *
     * @return String
     */
    public static String encrypt(String originalStr) {
        //org.springframework.util.DigestUtils
        String temp = DigestUtils.md5DigestAsHex(originalStr.getBytes());
        //org.apache.commons.lang3.StringUtils
        temp = StringUtils.reverse(temp);
        String encryptedStr = DigestUtils.md5DigestAsHex(temp.getBytes());
        return encryptedStr;
    }

}
